var player;
// 屏幕适配
function rotate() {
    const _img = document.getElementsByClassName('img__id');
    if (window.orientation == 180 || window.orientation == 0) {
        console.log('竖屏')
        $(_img).addClass('transverse--body__img');
        $(_img).removeClass('vertical--body__img');
    }
    if (window.orientation == 90 || window.orientation == -90) {
        console.log("横屏")
        $(_img).addClass('vertical--body__img');
        $(_img).removeClass('transverse--body__img');

    }
}
window.addEventListener("load", rotate, false);
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", rotate, false);

// 播放事件

// 播放完成事件
function video() {
    page++
    $("#_right").click();
}

// 播放
function playMusic() {
    var player = sounds[swiper.activeIndex].howl;
    autoNext(player)
    if (!player.playing()) {
        player.play();
        $(".load__start").hide();
    } else {
        player.pause();
    }
}

// 暂停播放
$("#imgBody").click(function () {
   var player = sounds[swiper.activeIndex].howl;

    $(".load__start").show();
    player.pause();
})

function autoNext(howl) {
    player = howl;
    player.on('end', function () {
        player.off();
        video();
    });
}